package com.hzy.fivepalace.service.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;

/**
 * redis监听订单支付超时配置
 */
@Configuration
public class OrderTimeoutConfig {

    private static final Logger logger = LoggerFactory.getLogger(OrderTimeoutConfig.class);

    @Bean
    public RedisMessageListenerContainer container(RedisConnectionFactory redisConnectionFactory) {
        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
        container.setConnectionFactory(redisConnectionFactory);
        logger.info("----------redis监听过期key配置生效----------");
        return container;
    }
}
